package com.kaigejava.guanchazhemoshi.javaobserver;


import lombok.Data;

import java.util.Observable;

/**
 * Created by kaigejava on 2019/8/12.
 * Java内置观察者模式-天气对象
 */
@Data
public class WeaterDataJava extends Observable {
    private float mTemperatrue;
    private float mPressure;
    private float mHumidity;

    public void dataChange(){
        this.setChanged();
        this.notifyObservers(new DataParam(this.getMTemperatrue(),this.mPressure,this.mHumidity));
    }

    public void setData(float mTemperatrue,float mPressure,float mHumidity)
    {
        this.mTemperatrue=mTemperatrue;
        this.mPressure=mPressure;
        this.mHumidity=mHumidity;
        dataChange();
    }
}
